package com.project.business.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.project.business.entity.constant.FileType;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @TableName file_t
 */
@TableName(value = "file_t")
@Data
public class FileEntity implements Serializable {
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 文件名称
     */
    private String name;

    /**
     * 文件大小
     */
    private Long size;

    /**
     * 文件类型
     */
    private FileType type;
    @TableField(exist = false)
    private String typeName;

    /**
     * 文件路径
     */
    private String filePath;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;


    /**
     * 更新时间
     */
    private LocalDateTime updatedTime;


    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    public String getTypeName() {
        return type.getDesc();
    }

    public void setTypeName() {
        this.typeName = type.getDesc();
    }
}